# Django settings for anima project.

import os.path
import sys
import posixpath

DEBUG = True
TEMPLATE_DEBUG = DEBUG
BASE_DIR = os.path.normpath(os.path.dirname(__file__))    #!! PARA PODER DESPLAZAR NUESTRA CARPETA DEL PROYECTO A CUALQUIER PARTE DE LA MAQUINA (O A OTRA) SIN QUE AFECTE A LOS ENLACES

sys.path.append(os.path.join(BASE_DIR, "apps/"))
print 'apps [OK]'

ADMINS = (
    ('Sheniff', 'sheniff@gmail.com'),
)

MANAGERS = ADMINS

DATABASES = {
    # 'default': {
    #     'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
    #     'NAME': os.path.join(BASE_DIR, "anima.db"),                      # Or path to database file if using sqlite3.
    #     'USER': '',                      # Not used with sqlite3.
    #     'PASSWORD': '',                  # Not used with sqlite3.
    #     'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
    #     'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
    # },
    
    #TABLA DE MYSQL EN LOCAL
    'default': {
        'ENGINE': 'django.db.backends.mysql',   # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
        'NAME': 'animaproject.es',              # Or path to database file if using sqlite3.
        'USER': 'animaproject.es',              # Not used with sqlite3.
        'PASSWORD': '4n1m4',                    # Not used with sqlite3.
        'HOST': 'localhost',                    # Set to empty string for localhost. Not used with sqlite3.
        'PORT': '',                             # Set to empty string for default. Not used with sqlite3.
    },    

    #TABLA PARA DESPLIEGUE, DESCOMENTAR PARA SUBIR A GONDOR
    #'default': {
        #'ENGINE': 'django.db.backends.mysql', 	# Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
		#'NAME': 'anima_testing',								# Or path to database file if using sqlite3.
		#'USER': 'sheniff',			        			# Not used with sqlite3.
		#'PASSWORD': 'sh3n1ff',           							# Not used with sqlite3.
		#'HOST': 'localhost',				                # Set to empty string for localhost. Not used with sqlite3.
		#'PORT': '3306',                    					# Set to empty string for default. Not used with sqlite3.
        #'OPTIONS' : {
			#'init_command': 'SET storage_engine=INNODB',		#Forzamos como motor de tablas InnoDB, que permite referencias
		#},
    #},
}

# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'Europe/Madrid'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'es-ES'

SITE_ID = 1

# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True

# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = os.path.join(BASE_DIR, "media")

# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"

#Ejecutar desde el directorio
#raiz --> "python manage.py collectstatic"
STATIC_ROOT = os.path.join(BASE_DIR, "static_deployment")
#STATIC_ROOT = os.path.join(BASE_DIR, "static")

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash if there is a path component (optional in other cases).
# Examples: "http://media.lawrence.com", "http://example.com/media/"
MEDIA_URL = '/site_media/'

# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"

STATIC_URL = '/site_media/static/'

# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
#ADMIN_MEDIA_PREFIX = '/media/'
ADMIN_MEDIA_PREFIX = posixpath.join(STATIC_URL, "admin/")

# Additional locations of static files
STATICFILES_DIRS = (
    # Put strings here, like "/home/html/static" or "C:/www/django/static".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
    os.path.join(BASE_DIR, "static"),
)

# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
#    'django.contrib.staticfiles.finders.DefaultStorageFinder',
)

# Make this unique, and don't share it with anybody.
SECRET_KEY = 'ub%r_ghte($i7v!+qb59tsdh6%n-++juvlox_f12n!&56_3^3g'

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.load_template_source',
    'django.template.loaders.app_directories.load_template_source',
#     'django.template.loaders.eggs.load_template_source',
)

MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.middleware.csrf.CsrfResponseMiddleware',
    'middleware.FichaAnimaMiddleware',
    'middleware.PartidaMiddleware',
    'middleware.PerfilMiddleware',
)

ROOT_URLCONF = 'anima.urls'

TEMPLATE_DIRS = (
    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
    #'templates',
	os.path.join(BASE_DIR, "static/templates/"),
)

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.staticfiles',
    #'registro',
    #'perfiles',
    'registration',
    'profiles',
    'fichas',
    'partidas',
    'django.contrib.admin',
    'django.contrib.webdesign',
)

#De Django-registration de Ubernostrum
ACCOUNT_ACTIVATION_DAYS = 7 # One-week activation window; you may, of course, use a different value.
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'sheniff.testing@gmail.com'
EMAIL_HOST_PASSWORD = 'animatesting'
EMAIL_PORT = 587


TEMPLATE_CONTEXT_PROCESSORS = (
    'django.core.context_processors.request',
    'django.core.context_processors.auth',
	'django.core.context_processors.media',
    'django.core.context_processors.static',
    'context_processors.listafichas',
    'context_processors.listapartidas',
    'context_processors.perfil',
)

LOGIN_URL = '/registro/login/'
LOGOUT_URL = '/registro/logout/'
LOGIN_REDIRECT_URL = '/inicial/'


AUTH_PROFILE_MODULE = 'profiles.UserProfile'
PUBLIC_PROFILE = False

DIR_PROFILES = os.path.join(BASE_DIR, 'profiles')

try:
    from local_settings import *
except ImportError:
    pass
